package me.hl.guava.collect;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * Created by haoliang on 2016/7/31.
 */
public class MultimapTest {

    private static Logger logger = LoggerFactory.getLogger(MultimapTest.class);

    @Test
    public void multimapTest() {
        Multimap<String, String> multimap = ArrayListMultimap.create();
        multimap.put("1", "1");
        List<String> list = Lists.newArrayList("4", "2", "3", "1");
        multimap.putAll("1", list);
        multimap.get("1").forEach((x) -> logger.info("{}", x));
        multimap.remove("1", "1");
        logger.info("remove one 1");
        multimap.get("1").forEach((x) -> logger.info("{}", x));
        multimap.removeAll("1");
        logger.info("removeAll 1");
        multimap.get("1").forEach((x) -> logger.info("{}", x));


    }
}
